<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>活动订单页</title>
    <tc_include file="Public:head" />
    <link rel="stylesheet" href="__TMPL__Public/invest/css/activeorder.css">
<style>
    .modal-header{
        border-bottom:none;
    }
</style>

</head>

<body>

<nav class="navbar navbar-default" role="navigation">
    <tc_include file="Public:nav" />
</nav>
<div class="container">
    <div class="centent">
        <div class="top-title">
            <p class="pull-left c-blue"><a href="event details.html"><span>《</span>返回上一页</a></p>
            <p class="pull-right yellow c-xin">核对信息</p>
        </div>
        <div class="clearfix"></div>
        <h3>核对订单信息</h3>
        <div class="c-information">
            <div class="table-responsive c-da-box">
                <table class="table">
                    <thead >
                    <tr style="border:none">
                        <th style="text-align:center">订单号</th>
                        <th style="text-align:center">名称</th>

                        <th>学币</th>
                        <th>金额</th>

                        <th>状态</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr style="border:none">
                        <td style="text-align:center" id="ordersn" data-sn="{$order_sn}">{$order_sn}</td>
                        <td style="text-align:center; color:#09f">{$goods_name}</td>
                        <td>{$goods_amount}</td>
                        <td>{$order_amount}</td>
                        <td><if condition="$pay_status eq 1">已付款<else />未付款</if> </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="clearfix"></div>
            <p class="pull-left c-grey">温馨提示：请尽快完成付款，系统会自动取消1小时内尚未付款订单</p>
            <p class="pull-right grey">应付学币：<span class="yellow" id="money-input" data-count="{$order_amount}" >￥{$order_amount}</span><span class="grey xuebi">(1学币=1元)</span></p>
            <div class="clearfix"></div>
        </div>
        <div class="c-zhong">
            <div id="example" class="modal fade in ">
                <div class="modal-box">
                    <div class="modal-header modal-h-img">
                        <a class="close a-close" data-dismiss="modal">×</a>
                        <img id="img" src="" />
                    </div>
                    <div class="modal-body modal-b-img">
                        <img src="__TMPL__Public/invest/images/sao-wei.png" />
                    </div>
                    <div class="modal-footer">
                        <p class="text-center">微信支付</p>
                    </div>
                </div>
            </div>
        </div>

        <div class="c-z-right">

            <p><a href="javascript:void(0)" data-toggle="" class="btn btn-primary btn-large wxzf">下一步</a></p>
            <p class="c-tishi grey">提示：目前支持微信付款方式。</p>
        </div>
    </div>
    <div class="clearfix"></div>
    <div class="c-piao">
        <p>购票说明：</p>
        <p>1. 若出现已成功充值提示， 但学币未到账，可能是网络或系统繁忙导致， 我们会在2个工作日内核对后为您充值；</p>
        <p>2. 在充值过程中如出现网页错误或打开缓慢时， 请先查询微信， 支付宝交易记录， 检查扣款是否<br>
            成功， 然后查看壹高账户是否成功充值。若没有确认， 请不要反复刷新页面， 以防止重复购买。</p>
        <p>3、若对活动存在疑问，请联系壹高客服人员（<span>020-29827009</span>）</p>
    </div>

</div>
</div>
<!--第七块footer-->
<div class="clearfix"></div>
<div class="footer">
    <tc_include file="Public:footer" />
</div>
</body>
</html>
<tc_include file="Public:scripts" />
<script src="__TMPL__Public/invest/js/bootstrap-modal.js"></script>
<script>
    $('.wxzf').click(function (event) {

        var money = $('#money-input').attr('data-count');
        var ordersn = $('#ordersn').attr('data-sn');
        var moneys = parseFloat(money);

        if (moneys) {
            $.ajax({
                type: "GET",
                url: "{:U('Payment/Index/native')}",
                data: {money: moneys, ordersn: ordersn},
                dataType: "json",
                success: function (data) {
                    if (data.status == 1) {
                       // console.log(data);
                        $('#img').attr('src', data.qrcode_url).show();
//                        $('.wxzf').attr('data-toggle', "modal");
//                        $('.wxzf').attr('href', "#example");
                        $('#example').show();
//                        $('.maskinga').show();
                        var int = setInterval(clockss, 1000)
                    }
                    function clockss() {
                        $.ajax({
                            type: "POST",
                            url: "{:U('Payment/Index/orinquire')}",
                            data: {order_sn: data.order_sn},
                            dataType: "json",
                            success: function (reule) {
                                console.log(reule.redirect)
                                if (reule.succeeds==1) {
                                    window.clearInterval(int)//取消由setInterval()方法设置的定时器。
//                                    window.history.back(-1);
                                    window.location.href = document.referrer;//返回上一页并刷新
                                }
                            }
                        })
                    }
                }
            });
        } else {
            art.dialog({
                content: "操作失败",
                icon: 'error',
                ok: function () {
                    window.location.reload();
                    return true;
                }
            });
        }


    });
    $('.close').click(function (event) {
        $('#example').hide();
    })
</script>
